package com.ten.shou.controller;


import com.ten.common.core.entity.EduCourse;
import com.ten.common.core.entity.TbZoneCourse;
import com.ten.common.core.vo.Result;
import com.ten.shou.feign.CourseListFeign;
import com.ten.shou.service.ZoneCourseService;
import com.ten.shou.vo.CourseCheckVo;
import com.ten.shou.vo.CourseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ：杨（1964958771@qq.com）
 * @date ：Created in 2022/12/7 18:04
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("home/zone-course")
@Api(tags = "专区课程接口类")
public class ZoneCourseController {
    @Resource
    private ZoneCourseService zoneService;
    @Resource
    private CourseListFeign courseListFeign;

    @ApiOperation(value = "根据条件ID分页查询专区信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "专区id"),
            @ApiImplicitParam(name = "current",value = "当前页码"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示的条数")
    })
    @PostMapping("/getAllDetail/{current}/{pageSize}/{id}")
    public Result getAllDetail(@PathVariable Integer current
                                , @PathVariable Integer pageSize
                                , @PathVariable String id
                                , @RequestBody CourseVo courseVo){
        return zoneService.getAllZoneCourse(current,pageSize,id,courseVo);
    }

    @PostMapping("findCourse/{pageCurrent}/{pageSize}")
    public Result findCourse(@PathVariable Integer pageCurrent,@PathVariable Integer pageSize,@RequestBody CourseCheckVo courseCheckVo){
        return zoneService.findCourse(pageCurrent,pageSize,courseCheckVo);
    }
   @PostMapping("addCourseDetail")
    public Result addCourseDetail(@RequestBody TbZoneCourse tbZoneCourse){
        return zoneService.addCourseDetail(tbZoneCourse);
   }
//    @GetMapping("getCourseByZoneId/{zoneId}")
//    public Result<List<EduCourse>> getCourseByZoneId(@PathVariable String zoneId) {
//        return zoneService.getCourseByZoneId(zoneId);
//    }

    @PostMapping("deleteZoneCourse")
    public Result deleteZoneCourse(@RequestBody TbZoneCourse tbZoneCourse){
        System.out.println("99999"+tbZoneCourse);
        return zoneService.deleteZoneCourse(tbZoneCourse);
    }
}
